﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Net.Mail;
using System.Net.Mime;

namespace Send2SMTP
{
    class MailThreadData
    {
        public MailThreadData DeepCopy()
        {
            MailThreadData copy = new MailThreadData();

            //
            // Value types...
            copy = (MailThreadData)this.MemberwiseClone();

            //
            // Ref types...
            copy.from = new MailAddress(this.from.Address, this.from.DisplayName);
            copy.toList = new List<MailAddress>();
            copy.ccList = new List<MailAddress>();
            copy.bccList = new List<MailAddress>();
            copy.attachmentList = new List<string>();

            foreach (MailAddress to in this.toList)
            {
                copy.toList.Add(new MailAddress(to.Address, to.DisplayName));
            }
            foreach (MailAddress cc in this.ccList)
            {
                copy.ccList.Add(new MailAddress(cc.Address, cc.DisplayName));
            }
            foreach (MailAddress bcc in this.bccList)
            {
                copy.bccList.Add(new MailAddress(bcc.Address, bcc.DisplayName));
            }
            copy.attachmentList = new List<string>(this.attachmentList);
            return copy;
        }

        public double attachProb = 0.0;
        public int minAttachments = 1;
        public int maxAttachments = 3;
        public string host = "";
        public int port = 25;
        public int copies = 1;
        public MailAddress from;
        public string subject = "Message %MESSAGENUM() sent %DATETIME() ";
        public string body = "This is test message number %MESSAGENUM sent on %DATETIME().\n\nThe following is random text.\n-------\n%RANDOMTEXT(5,50)\n\n";
        public bool bodyIsHTML = false;
        public List<MailAddress> toList = new List<MailAddress>();
        public List<MailAddress> ccList = new List<MailAddress>();
        public List<MailAddress> bccList = new List<MailAddress>();
        public List<string> attachmentList = new List<string>();
        public int threadId = 0;
        public int sentMessages = 0;
        public int messagesWithAttachments = 0;
        public int delay = 0;
        public bool useDefaultCreds = true;
        public string userName = "";
        public string password = "";
        public string domain = "";
        public int messageNo = 0;
        public bool useSSL = false;
    }

}
